-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [#4420] Validation for fields within AddressNL component #167
✨ [#4420] Validation for fields within AddressNL component #167
Conversation
a47cf07
to
5f1d2e7
Compare
e7194c1
to
78c9ade
Compare
76a1ac6
to
d7bf6b2
Compare
d7bf6b2
to
bb41eb4
Compare
bb41eb4
to
b064b40
Compare
d6feb8a
to
01713f8
Compare
01713f8
to
91f9da5
Compare
cee83da
to
4027f66
Compare
const patternInput = canvas.getByLabelText( | ||
'Regular expression for postcode' | ||
) as HTMLInputElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the as
casting should not be needed, often you can pass the expected type as a generic param: getByLabelText<HTMLInputElement>
or if the problem is that it can be null
or undefined
, you can add an exclamation mark at the end saying that you know it will resolve:
canvas.getByLabelText("some label")!;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll pass the generic param, the exclamation mark doesn't work, it gives me the same error as when I don't add the type at all: Property 'value' does not exist on type 'HTMLElement'.ts(2339)
(on the line expect(patternInput.value).toBe('Amsterdam');
)
f3e73a6
to
65e171e
Compare
65e171e
to
a431899
Compare
the following components can now be validated using regex: * postcode * city
* Use stricter types for the SubComponentValidation react component prop - not any string is accepted, it must be one of the two union members defined in the type * pass the correct validation schema to 'useManageValidatorsTranslations', using the subcomponent schemas defined in the type
* use prefix for AddressNL SubcomponentValidation and useManageValidatorsTranslations * remove unnecessary waitFor blocks in AddressNL stories * add aria-label to datamap
by replacing getByLabelText with findByLabelText after userEvent.click(...)
78af523
to
d540808
Compare
partially closes open-formulieren/open-forms#4420
Requires open-formulieren/types#51 to be merged and released first